package com.ruoyi.project.module.route.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.module.route.mapper.RouteMapper;
import com.ruoyi.project.module.route.domain.Route;
import com.ruoyi.project.module.route.service.IRouteService;
import com.ruoyi.common.support.Convert;

/**
 * 业务路由 服务层实现
 * 
 * @author ruoyi
 * @date 2018-07-27
 */
@Service
public class RouteServiceImpl implements IRouteService 
{
	@Autowired
	private RouteMapper routeMapper;

	/**
     * 查询业务路由信息
     * 
     * @param routeId 业务路由ID
     * @return 业务路由信息
     */
    @Override
	public Route selectRouteById(Integer routeId)
	{
	    return routeMapper.selectRouteById(routeId);
	}
	
	/**
     * 查询业务路由列表
     * 
     * @param route 业务路由信息
     * @return 业务路由集合
     */
	@Override
	public List<Route> selectRouteList(Route route)
	{
	    return routeMapper.selectRouteList(route);
	}
	
    /**
     * 新增业务路由
     * 
     * @param route 业务路由信息
     * @return 结果
     */
	@Override
	public int insertRoute(Route route)
	{
	    return routeMapper.insertRoute(route);
	}
	
	/**
     * 修改业务路由
     * 
     * @param route 业务路由信息
     * @return 结果
     */
	@Override
	public int updateRoute(Route route)
	{
	    return routeMapper.updateRoute(route);
	}
	
	/**
     * 保存业务路由
     * 
     * @param route 业务路由信息
     * @return 结果
     */
	@Override
	public int saveRoute(Route route)
	{
	    Integer routeId = route.getRouteId();
		int rows = 0;
		if (StringUtils.isNotNull(routeId))
        {
		    rows = routeMapper.updateRoute(route);
		}
		else
        {
		    rows = routeMapper.insertRoute(route);
		}
		return rows;
	}
	
	/**
     * 删除业务路由对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteRouteByIds(String ids)
	{
		return routeMapper.deleteRouteByIds(Convert.toStrArray(ids));
	}
	
}
